package radioButton;

import java.awt.BorderLayout;
import java.awt.EventQueue;
import java.awt.FlowLayout;

import javax.swing.ButtonGroup;
import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.JRadioButton;
import javax.swing.border.EmptyBorder;

public class TestJRadioButton2 extends JFrame {

	private JPanel contentPane;

	/**
	 * Launch the application.
	 */
	public static void main(String[] args) {
		EventQueue.invokeLater(new Runnable() {
			public void run() {
				try {
					TestJRadioButton2 frame = new TestJRadioButton2();
					frame.setVisible(true);
				} catch (Exception e) {
					e.printStackTrace();
				}
			}
		});
	}

	/**
	 * Create the frame.
	 */
	public TestJRadioButton2() {
		setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
		setBounds(100, 100, 450, 300);
		contentPane = new JPanel();
		contentPane.setBorder(new EmptyBorder(5, 5, 5, 5));
		contentPane.setLayout(new BorderLayout(0, 0));
		setContentPane(contentPane);
		
		ButtonGroup btnGroup = 	new ButtonGroup();			//necessari per a que siguin exclusius
		JRadioButton mujer = new JRadioButton("mujer", true);
		JRadioButton hombre = new JRadioButton("hombre");
		JRadioButton orco = new JRadioButton("orco");
		btnGroup.add(mujer);
		btnGroup.add(hombre);
		btnGroup.add(orco);
		contentPane.setLayout(new FlowLayout(FlowLayout.CENTER,5,5));
		mujer.setBounds(10, 10, 140, 20);
		hombre.setBounds(150, 10, 140, 20);
		contentPane.add(mujer);
		contentPane.add(hombre);
		contentPane.add(orco);
		
	}

}
